<!--#include file="../Inc/conn.asp"-->
<!--#include file="Admin_check.asp"-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>网站后台管理</title>
<link href="images/Admin_css.css" type=text/css rel=stylesheet>
<script src="js/admin.js"></script>
</head>

<body>
<%
Call chkAdmin(18)
	if request("action") = "google" then 
		call google()
	elseif request("action")="savegoogle" then
		call savegoogle("../")
	else
		call google()
	end if

sub google()
%>
		<table width="100%" border="0" cellpadding="0" cellspacing="1" class="admintable1">
        <form action="?action=savegoogle" name="myform" method=post>
          <tr>
            <td height="10" colspan="2" class="admintitle">生成google地图</td>
          </tr>
          <tr>
            <td width="28%" height="30" align="right" bgcolor="#FFFFFF">地图链接：</td>
            <td align="left" bgcolor="#FFFFFF">
              <input name="links" type="text" id="links" value="200" />
              <span class="note">链接数,GOOGLE规范要求不得大于50,000</span> </td>
          </tr>
          <tr>
            <td height="30" align="right" bgcolor="#FFFFFF">时区偏移：</td>
            <td align="left" bgcolor="#FFFFFF">
              <input name="timex" type="text" id="timex" value="8" />
              <span class="note">默认中国大陆为8</span> </td>
          </tr>
          <tr>
            <td height="30" align="right" bgcolor="#FFFFFF">&nbsp;</td>
            <td align="left" bgcolor="#FFFFFF">
              <input name="Submit" type="submit" class="bnt" value=" 生 成 " />            </td>
          </tr>
          <tr>
            <td height="10" colspan="2" align="right"></td>
          </tr>
          </form>
</table>
<%
end sub

sub savegoogle(strPath)
	XMLContent = "<?xml version='1.0' encoding='UTF-8'?>" & vbNewLine
	XMLContent = XMLContent & "<urlset xmlns=""http://www.google.com/schemas/sitemap/0.84"">" & vbNewLine
	set rs1=server.createobject("ADODB.Recordset")
	sql1="select Top "&Request("links")&" ID from "&tbname&"_Article where yn = 0 order by DateAndTime desc"
	rs1.open sql1,conn,1,3
	do while not (rs1.eof or err)
	XMLContent = XMLContent & "<url>" & vbNewLine
	Timex = Request("Timex")
	Timex = Right("0" & Timex ,2) & ":00"
	aTime = Year(now()) & "-" & Right("0" & Month(now()),2) & "-" & Right("0" & Day(now()),2) & "T" & Right("0" & Hour(now()),2) & ":" & Right("0" & Minute(now()),2) & ":" & Right("0" & Second(now()),2) & "+" & Timex
	XMLContent = XMLContent & "<loc>http://"&Siteurl&apath(rs1("ID"),0)&""
	XMLContent = XMLContent & "</loc>" & vbNewLine & "<lastmod>" & aTime & "</lastmod>" & vbNewLine
	XMLContent = XMLContent & "<changefreq>daily</changefreq>" & vbNewLine
	XMLContent = XMLContent & "<priority>0."&RndNumber(1,9)&"</priority>" & vbNewLine
	XMLContent = XMLContent & "</url>" & vbNewLine
	rs1.movenext
	loop
	rs1.close
	set rs1=nothing
	XMLContent = XMLContent & "</urlset>"
	strPath = Server.MapPath(strPath) & "\Sitemap.xml"
	CreateXMLFile XMLContent,strPath
	Call Info("生成站点地图成功！<br><br><a href=""http://"&SiteUrl&SitePath&"Sitemap.xml"" target=""_blank"">点此浏览</a>,<a href='http://www.google.cn/webmasters/sitemaps/ping?sitemap=http://" & Request.Servervariables("Server_Name") & ""&SitePath&"Sitemap.xml' target='_blank'><font style='color:blue'>点击这里提交到谷歌</font></a>")
end sub

Function CreateXMLFile(sXML,FilePath)
	Dim objXML
	If InStr(FilePath, ":") = 0 Then FilePath = Server.MapPath(FilePath)
	Set objXML = Server.CreateObject("MSXML2.DOMDocument.3.0") 
	If objXML.LoadXml(sXML) Then
		objXML.Save(FilePath)
	End If
	Set objXML = Nothing
End Function 
%>
<!--#include file="Admin_copy.asp"-->
</body>
</html>